<?php
class SucculentPlantAction extends SzAbstractAction
{
    protected $paramTypes = array(
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_STRING,
        SzAbstractAction::TYPE_INT,
        SzAbstractAction::TYPE_INT,
    );

    /**
     *  多肉种植
     *
     * @param int $userId
     * @param string $pos
     * @param int $seedId
     * @param int $reqTime
     * @return SzResponse
     */
    public function execute($userId, $pos, $seedId, $reqTime)
    {
        if (!GameService::get()->verifySysUnlock($userId, GameConst::FUNC_SUCCLENT_PLANT)) {
            return $this->buildResponse(false);
        }

        GameService::get()->validateMultiRequestTimeDelta($userId, $reqTime);

        $plant = SucculentService::get()->plant($userId, $pos, $seedId, $reqTime);
        return $this->buildResponse(array(
            'plant' => $plant->toArray()
        ));
    }
}